package ${package}.serviceImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.apache.log4j.Logger;

import ${package}.query.${table_name}Query;
import ${package}.model.${table_name};

import ${package}.mapping.${table_name}Mapper;
import ${package}.service.I${table_name}Service;

@Service("${raw_table}Service") 
public class ${table_name}ServiceImpl implements I${table_name}Service {

	private Logger log = Logger.getLogger(this.getClass());

	@Resource
	private ${table_name}Mapper ${table_name?uncap_first}Mapper;
	
	/**************************************${table_name} start******************************************/
		/**
		 * 说明：
		 * @param ${table_name?uncap_first}
		 * @return 
		 */
		public int add${table_name}(${table_name} ${table_name?uncap_first}){
				return this.${table_name?uncap_first}Mapper.insert${table_name}(${table_name?uncap_first});
		}
		/**
		 * 说明：
		 * @param ${table_name?uncap_first}
		 * @return
		 */
		public void remove${table_name}ById(Long ${j_primary_key}){
			this.${table_name?uncap_first}Mapper.delete${table_name}ById(${j_primary_key});
		}
		/**
		 * 说明：
		 * @param ${table_name?uncap_first}
		 * @return
		 */
		public String modify${table_name}ById(${table_name} ${table_name?uncap_first}){
					this.${table_name?uncap_first}Mapper.update${table_name}ById(${table_name?uncap_first});
			return "1";
		}
		/**
		 * 说明：
		 * @param ${table_name?uncap_first}
		 * @return  ${table_name?uncap_first}对象
		 */
		public ${table_name} find${table_name}ById(Long ${j_primary_key}){
			return this.${table_name?uncap_first}Mapper.query${table_name}ById(${j_primary_key});
		}
		/**
		 * 说明：
		 * @param ${table_name?uncap_first}
		 * @return  List<${table_name}>
		 */
		public List<${table_name} > find${table_name}List(${table_name}Query query){
			return this.${table_name?uncap_first}Mapper.query${table_name}List(query);
		}
		/**
		 * 说明：
		 * @param ${table_name?uncap_first}
		 * @return List<${table_name}>
		 */
		public Map<String , Object> find${table_name}PageList(${table_name}Query query){
			List<${table_name}> ${table_name?uncap_first}List = this.${table_name?uncap_first}Mapper.queryPage${table_name}List(query);
			Map<String , Object> map = new HashMap<String, Object>();
			map.put("data", ${table_name?uncap_first}List);
			map.put("page", query.getPage());
			return map;
		}
	
/*************************************${table_name} end*************************************/

}